package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 胡慧
 * @title: AdSensitiveController
 * @projectName heima-leadnews
 * @description: 敏感词
 * @date 2021/2/516:42
 */
@RestController
@Slf4j
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController {
    @Autowired
    private AdSensitiveService adSensitiveService;
    @PostMapping("/list")
    public ResponseResult list(@RequestBody SensitiveDto dto){
      return adSensitiveService.findSensitive(dto);
    }
    @PostMapping("/save")
    public ResponseResult save(@RequestBody AdSensitive adSensitive){
        return adSensitiveService.insert(adSensitive);
    }
    @PostMapping("/update")
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.edit(adSensitive);
    }
    @DeleteMapping("/del/{id}")
    public ResponseResult delete(@PathVariable("id") Integer id) {
        return adSensitiveService.delete(id);
    }
}
